import { contextBridge, ipcRenderer,screen,shell } from "electron";

contextBridge.exposeInMainWorld("versions", {
  node: () => process.versions.node,
  chrome: () => process.versions.chrome,
  electron: () => process.versions.electron,
});

contextBridge.exposeInMainWorld("electronIpc", {
  ipcOn:(name:string,callback:any) =>{
   ipcRenderer.on(name,callback)
  },
  ipcOnce:(name:string,callback:any) =>{
    ipcRenderer.once(name,callback)
  },
  ipcRemove:(name:string,callback:any)=>{
    ipcRenderer.removeListener(name,callback)
  },
  ipcInvoke:(name:string,message:string):Promise<any>=>{
    return ipcRenderer.invoke(name,message)
  },
  ipcSend:(name:string,message?:string):void=>{
    ipcRenderer.send(name,message)
  },
  ipcSendSync:(name:string,message?:string):any=>{
    return ipcRenderer.sendSync(name,message)
  },
  ipcSendTo:(id:number,channel:string,...args:any[]):void=>{
    ipcRenderer.sendTo(id,channel,args) 
  }
});
